package com.yue.jersey.practice.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * 功能描述: TODO <br/>
 * 创建时间: 2016/12/14<br/>
 *
 * @author QiuYang
 */
@Aspect
@Component
public class ServiceAspect {

    @Pointcut("execution(* com.yue.jersey.practice..*.* (..))")
    public void logPointcut(){}

    @Before("logPointcut()")
    public void doBefore(JoinPoint joinPoint){
    }

    @Before("logPointcut() && args(name)")
    public void getArgs(JoinPoint joinPoint, String name){
        System.out.println(name);
    }

    @Before("logPointcut() && @args(com.yue.jersey.practice.annotation.CWord)")
    public void testargs(JoinPoint joinPoint){
//        joinPoint.getArgs();
        Signature signature = joinPoint.getSignature();
        System.out.println(signature.toString());
        System.out.println(signature.toShortString());
        System.out.println(signature.toLongString());
    }

}
